package com.imdroid.carac.services;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.imdroid.carac.activities.StartupActivity;

public class BootReceiver extends BroadcastReceiver {

	private static final String BOOT = "android.intent.action.BOOT_COMPLETED";

	/*
	 * (non-Javadoc)
	 * 
	 * @see android.content.BroadcastReceiver#onReceive(android.content.Context,
	 * android.content.Intent)
	 */
	public void onReceive(Context context, Intent intent) {
		Log.d(this.getClass().getSimpleName(), "..." + intent.getAction());
		// 监听机器启动消息
		if (intent.getAction().equals(BOOT)) {
			Log.d(this.getClass().getSimpleName(), "Booting....");
			Intent ootStartIntent = new Intent(context, StartupActivity.class);
			ootStartIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(ootStartIntent);
		}
	}
}
